
<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?>
<title><?= $sf_response->getTitle() ?></title>
<td><?php
    if ($tally_in->getStatus()==CommonValues::$gTLStatus['key']['Initial'])
        echo link_to($tally_in->getTallyincode() ? $tally_in->getTallyincode() : __('-'), 'tallyin/edit?id='.$tally_in->getId());
    else
        //echo $tally_in->getTallyincode() ? $tally_in->getTallyincode() : __('-');
        echo link_to($tally_in->getTallyincode() ? $tally_in->getTallyincode() : __('-'), 'tallyin/edit?id='.$tally_in->getId());
    ?></td>

    <td><?php echo CommonValues::$gTallyInType['value'][$tally_in->getType()] ?></td>
    <td><?
    if ($tally_in->getType() ==CommonValues::$gTallyInType['key']['Project'])
        {
            echo $tally_in->getProject();
        }
    else if ($tally_in->getType() ==CommonValues::$gTallyInType['key']['Production'])
      {
          $object = ProjectPeer::retrieveByPK($tally_in->getTallyno());
          echo $object->getName();
      }
      else  if ($tally_in->getType() ==CommonValues::$gTallyInType['key']['Supplier']) 
      {
            $PO = POPeer::retrieveByPK($tally_in->getTallyno());
            if ($PO->getProjectId() != null)
                echo $PO->getProject();
      }
        
    ?></td>
    <td><?php 
        if ($tally_in->getType() ==CommonValues::$gTallyInType['key']['Supplier']) {
            $object = POPeer::retrieveByPK($tally_in->getTallyno());
            echo $object? $object->getPono() : '-'; 
        } elseif ($tally_in->getType() ==CommonValues::$gTallyInType['key']['Project']) {
            $object = BOMPeer::retrieveByPK($tally_in->getTallyno());
            echo $object? $object->getWono() : '-'; 
        } elseif ($tally_in->getType() ==CommonValues::$gTallyInType['key']['Production']) {
            $object = ProjectPeer::retrieveByPK($tally_in->getTallyno());
            echo $object? $object->getSaleno(): '-';
        } else echo $tally_in->getTallyno() ;
    ?></td>
      <td><?php echo ($tally_in->getCreatedAt() !== null && $tally_in->getCreatedAt() !== '') ? format_date($tally_in->getCreatedAt(), "D") : '' ?></td>

<td><?php
    $TitleQty = 'Received Quantity';
    if ($tally_in->getType()==CommonValues::$gTallyInType['key']['Service']) $TitleQty = 'Return Qty';
    elseif  ($tally_in->getType()==CommonValues::$gTallyInType['key']['Production']) $TitleQty = 'Return Unused Qty';

    echo link_to($tally_in->getComponentgroupId() ? image_tag('/sf/sf_admin/images/list.png', array('alt' => 'List', 'title' => 'List')):  __('-'), 'component/SLListModuleGroup?code='.$tally_in->getTallyincode().'&componentgroup_id='.$tally_in->getComponentgroupId()."&titleqty=$TitleQty&NotShowDate=1&Authentication=VIEW_TALLYIN&backURL=tallyin~1list~2id~4".$tally_in->getId());
?></td>

      <td><?php $user = sfGuardUserPeer::retrieveByPK($tally_in->getUserId()); echo $user? $user->getFullname(): ''?></td>
      <td><?php echo CommonValues::$gTLStatus['value'][$tally_in->getStatus()] ?></td>